package com.liao.badminton.vo;

import com.liao.badminton.code.BaseField;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
import com.liao.badminton.entity.UserGroupRef;
/**
* @author liaocheng
* @date 2024-11-01
* description:用户和群关系
*/
@Data
public class UserGroupRefVo  extends BaseField {

    @ApiModelProperty(value = "id")
    private Long id;

    @ApiModelProperty(value = "群id")
    private Long groupId;
    @ApiModelProperty(value = "群名称")
    private String groupName;

    @ApiModelProperty(value = "用户id")
    private Long userId;

    @ApiModelProperty(value = "用户名称")
    private String userName;

    @ApiModelProperty(value = "0:普通成员,1:管理员,2:群主")
    private Integer adminType;

    @ApiModelProperty(value = "总局数")
    private Integer totalBout;

    @ApiModelProperty(value = "总胜局数")
    private Integer winBout;

    @ApiModelProperty(value = "总负局数")
    private Integer loseBout;
    @ApiModelProperty(value = "参加打水次数")
    private Integer competitionNum;

    @ApiModelProperty(value = "参加活动次数")
    private Integer activityNum;

    @ApiModelProperty(value = "活动消费")
    private BigDecimal activityCost;

    @ApiModelProperty(value = "总得分")
    private Integer totalScore;
    @ApiModelProperty(value = "总奖励")
    private BigDecimal awardCoin;
    @ApiModelProperty(value = "默认登录群：0否，1是")
    private Integer loginDefault;
    @ApiModelProperty(value = "性别：0女，1男")
    private Integer sex;
    @ApiModelProperty(value = "胜率=winBout/totalBout")
    private BigDecimal winRate;
    private List<Long> delIds;  //批量删除ids

    //非数据库字段
    @ApiModelProperty(value = "规则等级id")
    private Long stipulationLevelId;
    private String levelName;  //规则等级名称
    @ApiModelProperty(value = "作用：比如前5名，要让5分，后5名，要+5分")
    private BigDecimal effect;

    public static UserGroupRefVo invertToVo(UserGroupRef userGroupRef){
        UserGroupRefVo vo = new UserGroupRefVo();
        BaseField.invert(userGroupRef, vo);
        vo.setId(userGroupRef.getId());
        vo.setGroupId(userGroupRef.getGroupId());
        vo.setUserId(userGroupRef.getUserId());
        vo.setUserName(userGroupRef.getUserName());
        vo.setAdminType(userGroupRef.getAdminType());
        vo.setCompetitionNum(userGroupRef.getCompetitionNum());
        vo.setActivityNum(userGroupRef.getActivityNum());
        vo.setActivityCost(userGroupRef.getActivityCost());
        vo.setTotalBout(userGroupRef.getTotalBout());
        vo.setWinBout(userGroupRef.getWinBout());
        vo.setLoseBout(userGroupRef.getLoseBout());
        vo.setTotalScore(userGroupRef.getTotalScore());
        vo.setAwardCoin(userGroupRef.getAwardCoin());
        vo.setLoginDefault(userGroupRef.getLoginDefault());
        vo.setSex(userGroupRef.getSex());
        return vo;
    }
}
